const jwt = require('jsonwebtoken')
const { secretOrPrivateKey, jwtExpiresIn } = require('../config/app')

module.exports = {
  //  加密jwt
  sign: (json = {}) => jwt.sign(json, secretOrPrivateKey, { expiresIn: jwtExpiresIn }),
  //  解密jwt
  verify: (authorization, callback) => jwt.verify(authorization, secretOrPrivateKey, callback)
}
